﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CCWOnline.WebControls;
using LLFM.CAT.Service;
using LLFM.CAT.Model;

public partial class Admin_Product_SeriesList : AdminPage
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Pager_PageChanging(object sender, PageChangingEventArgs e)
    {
        BindList(e.NewStartRecordIndex, Pager.PageSize);
    }

    private void BindList(int start, int number)
    {
        int count ;
        int pageCount;
        seriesRepeater.DataSource = SeriesService.GetSeriesListForPage(1, Pager.PageIndex, Pager.PageSize, out count, out pageCount);
        seriesRepeater.DataBind();
        Pager.RecordCount = count;
    }

    protected void SeriesItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            M_Series series = (M_Series)e.Item.DataItem;
            LinkButton modifyBtn = (LinkButton)e.Item.FindControl("modify");
            modifyBtn.CommandArgument = series.Id.ToString();
        }
    }

    protected void SeriesItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "modify")
        {
            int seriesId = Common.TypeParse.StrToInt(e.CommandArgument, 0);
            Response.Redirect("ModifySeries.aspx?seriesId=" + seriesId);
        }
    }

}